home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the 3D Game Programming Gurus / gurus.iso / DirectX / dx9sdkcp.exe / SDK (C++) / Include / tune.h < prev    next >
Encoding:
C/C++ Source or Header  |  2002-11-12  |  40.8 KB  |  1,108 lines

  1. //------------------------------------------------------------------------------
  2. // File: Tune.h
  3. //
  4. // Desc: Additional infrastructure to extend the tuner.idl.  Works nicely
  5. //       from C++.
  6. //
  7. // Copyright (c) 1999 - 2001, Microsoft Corporation.  All rights reserved.
  8. //------------------------------------------------------------------------------
  9.  
  10.  
  11. #pragma once
  12.  
  13. #ifndef TUNE_H
  14. #define TUNE_H
  15.  
  16. #include <tuner.h>
  17.  
  18. namespace BDATuningModel {
  19.  
  20. const long DEFAULT_MIN_CHANNEL = 2;
  21. const long DEFAULT_MAX_CHANNEL = 999;
  22. const long DEFAULT_MIN_FREQUENCY = 535;  //bottom us am
  23. const long DEFAULT_MAX_FREQUENCY = 108000; // top us fm
  24. const long DEFAULT_ANALOG_TUNER_COUNTRY_CODE = 1; //usa
  25. const TunerInputType DEFAULT_ANALOG_TUNER_INPUT_TYPE = TunerInputCable; //usa
  26.  
  27. typedef CComQIPtr<ITuningSpaceContainer> PQTuningSpaceContainer;
  28. typedef CComQIPtr<ITuningSpace> PQTuningSpace;
  29. typedef CComQIPtr<IAnalogRadioTuningSpace> PQAnalogRadioTuningSpace;
  30. typedef CComQIPtr<IAnalogTVTuningSpace> PQAnalogTVTuningSpace;
  31. typedef CComQIPtr<IATSCTuningSpace> PQATSCTuningSpace;
  32. typedef CComQIPtr<ITuneRequest> PQTuneRequest;
  33. typedef CComQIPtr<IChannelTuneRequest> PQChannelTuneRequest;
  34. typedef CComQIPtr<IATSCChannelTuneRequest> PQATSCChannelTuneRequest;
  35. typedef CComQIPtr<ILocator> PQLocator;
  36. typedef CComQIPtr<IATSCLocator> PQATSCLocator;
  37. typedef CComQIPtr<IDVBTuningSpace> PQDVBTuningSpace;
  38. typedef CComQIPtr<IDVBTuneRequest> PQDVBTuneRequest;
  39. typedef CComQIPtr<IDVBSLocator> PQDVBSLocator;
  40. typedef CComQIPtr<IDVBTLocator> PQDVBTLocator;
  41. typedef CComQIPtr<IDVBCLocator> PQDVBCLocator;
  42. typedef CComQIPtr<IAuxInTuningSpace> PQAuxInTuningSpace;
  43.  
  44. // tuning space container
  45. class TNTuningSpaceContainer : public PQTuningSpaceContainer {
  46.      TNTuningSpaceContainer() {}
  47.      TNTuningSpaceContainer(const PQTuningSpaceContainer &a) : PQTuningSpaceContainer(a) {}
  48.      TNTuningSpaceContainer(ITuningSpace *p) : PQTuningSpaceContainer(p) {}
  49.      TNTuningSpaceContainer(IUnknown *p) : PQTuningSpaceContainer(p) {}
  50.      TNTuningSpaceContainer(const TNTuningSpaceContainer &a) : PQTuningSpaceContainer(a) {}
  51.      TNTuningSpaceContainer& operator=(TNTuningSpaceContainer& rhs) {
  52.         PQTuningSpaceContainer::operator=(rhs);
  53.         return *this;
  54.     }
  55.  
  56. };
  57.  
  58. // tuning spaces
  59. template<class TUNINGSPACETYPE, class TUNEREQUESTTYPE> class TNTuningSpaceHelper : public TUNINGSPACETYPE {
  60. public:
  61.     TNTuningSpaceHelper() {}
  62.     TNTuningSpaceHelper(const TUNINGSPACETYPE &a) : TUNINGSPACETYPE(a) {}
  63.     TNTuningSpaceHelper(ITuningSpace *p) : TUNINGSPACETYPE(p) {}
  64.     TNTuningSpaceHelper(IUnknown *p) : TUNINGSPACETYPE(p) {}
  65.     TNTuningSpaceHelper(const TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE> &a) : TUNINGSPACETYPE(a) {}
  66.     TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& rhs) {
  67.         TUNINGSPACETYPE::operator=(rhs);
  68.         return *this;
  69.     }
  70.     TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(TUNINGSPACETYPE& rhs) {
  71.         TUNINGSPACETYPE::operator=(rhs);
  72.         return *this;
  73.     }
  74.     TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(IUnknown *rhs) {
  75.         TUNINGSPACETYPE::operator=(rhs);
  76.         return *this;
  77.     }
  78.     TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(ITuningSpace *rhs) {
  79.         TUNINGSPACETYPE::operator=(rhs);
  80.         return *this;
  81.     }
  82.     bool  operator==(TUNINGSPACETYPE& rhs) {
  83.         CComBSTR rhsname;
  84.         HRESULT hr = rhs->get_UniqueName(&rhsname);
  85.         if (FAILED(hr)) {
  86.             return false;
  87.         }
  88.         CComBSTR name;
  89.         hr = (*this)->get_UniqueName(&name);
  90.         if (FAILED(hr)) {
  91.             return false;
  92.         }
  93.         return name == rhsname;
  94.     }
  95.     bool  operator!=(TUNINGSPACETYPE& rhs) {
  96.         return !operator==(rhs);
  97.     }
  98.     PQTuneRequest CreateTuneRequest() {
  99.         PQTuneRequest p;
  100.         HRESULT hr = (*this)->CreateTuneRequest(&p);
  101.         if (FAILED(hr)) {
  102.             return PQTuneRequest();
  103.         }
  104.         return p;
  105.     }
  106.  
  107.     PQLocator Locator() {
  108.         _ASSERT(*this);
  109.         PQLocator ts;
  110.         HRESULT hr = (*this)->get_DefaultLocator(&ts);
  111.         if (FAILED(hr)) {
  112.             return PQLocator();
  113.         }
  114.         return ts;
  115.     }
  116.  
  117.     HRESULT Locator(PQLocator& l) {
  118.         _ASSERT(*this);
  119.         return (*this)->put_Locator(l);
  120.     }
  121.  
  122.     void Clone() {
  123.         PQTuningSpace t;
  124.         HRESULT hr = (*this)->Clone(&t);
  125.         if (FAILED(hr) || !t) {
  126.             Release();  // clone failed, clear ourselves
  127.             return;
  128.         }
  129.         TUNINGSPACETYPE::operator=(t);
  130.     }
  131.  
  132. };
  133.  
  134. typedef TNTuningSpaceHelper<PQTuningSpace, PQTuneRequest> TNTuningSpace;
  135.  
  136. template<class TUNINGSPACETYPE, class TUNEREQUESTTYPE> class TNAnalogRadioTuningSpaceHelper : public TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE> {
  137. public:
  138.      TNAnalogRadioTuningSpaceHelper() {}
  139.      TNAnalogRadioTuningSpaceHelper(const TUNINGSPACETYPE &a) : TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>(a) {}
  140.      TNAnalogRadioTuningSpaceHelper(IUnknown *p) : TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>(p) {}
  141.      TNAnalogRadioTuningSpaceHelper(const TNAnalogRadioTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE> &a) : TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>(a) {}
  142.      TNAnalogRadioTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(TNAnalogRadioTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& rhs) {
  143.         TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>::operator=(rhs);
  144.         return *this;
  145.      }
  146.      template<class TS, class TR> TNAnalogRadioTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(TNTuningSpaceHelper<TS, TR>& rhs) {
  147.         TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>::operator=(TUNINGSPACETYPE(rhs));
  148.         return *this;
  149.      }
  150.      TNAnalogRadioTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(TUNINGSPACETYPE& rhs) {
  151.         TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>::operator=(rhs);
  152.         return *this;
  153.     }
  154.      TNAnalogRadioTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(IUnknown* rhs) {
  155.         TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>::operator=(rhs);
  156.         return *this;
  157.     }
  158.     long MaxFrequency() {
  159.         _ASSERT(*this);
  160.         long freq;
  161.         HRESULT hr = (*this)->get_MaxFrequency(&freq);
  162.         if (FAILED(hr)) {
  163.             freq = DEFAULT_MAX_FREQUENCY;
  164.         }
  165.         return freq;
  166.     }
  167.     HRESULT MaxFrequency(long freq) {
  168.         _ASSERT(*this);
  169.         return (*this)->put_MaxFrequency(freq);
  170.     }
  171.     long MinFrequency() {
  172.         _ASSERT(*this);
  173.         long freq;
  174.         HRESULT hr = (*this)->get_MinFrequency(&freq);
  175.         if (FAILED(hr)) {
  176.             freq = DEFAULT_MIN_FREQUENCY;
  177.         }
  178.         return freq;
  179.     }
  180.     HRESULT MinFrequency(long freq) {
  181.         _ASSERT(*this);
  182.         return (*this)->put_MinFrequency(freq);
  183.     }
  184. };
  185. typedef TNAnalogRadioTuningSpaceHelper<PQAnalogRadioTuningSpace, PQChannelTuneRequest> TNAnalogRadioTuningSpace;
  186.  
  187. template<class TUNINGSPACETYPE, class TUNEREQUESTTYPE> class TNAnalogTVTuningSpaceHelper : public TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE> {
  188. public:
  189.     TNAnalogTVTuningSpaceHelper() {}
  190.     TNAnalogTVTuningSpaceHelper(const TUNINGSPACETYPE &a) : TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>(a) {}
  191.     TNAnalogTVTuningSpaceHelper(IUnknown *p) : TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>(p) {}
  192.     TNAnalogTVTuningSpaceHelper(const TNAnalogTVTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE> &a) : TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>(a) {}
  193.     TNAnalogTVTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(TNAnalogTVTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& rhs) {
  194.         TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>::operator=(rhs);
  195.         return *this;
  196.     }
  197.     template<class TS, class TR> TNAnalogTVTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(TNTuningSpaceHelper<TS, TR>& rhs) {
  198.         TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>::operator=(TUNINGSPACETYPE(rhs));
  199.         return *this;
  200.     }
  201.     TNAnalogTVTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(TUNINGSPACETYPE& rhs) {
  202.         TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>::operator=(rhs);
  203.         return *this;
  204.     }
  205.     TNAnalogTVTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(IUnknown* rhs) {
  206.         TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>::operator=(rhs);
  207.         return *this;
  208.     }
  209.     TunerInputType InputType() {
  210.         _ASSERT(*this);
  211.         TunerInputType ti;
  212.         HRESULT hr = (*this)->get_InputType(&ti);
  213.         if (FAILED(hr)) {
  214.             ti = DEFAULT_ANALOG_TUNER_INPUT_TYPE;
  215.         }
  216.         return ti;
  217.     }
  218.     HRESULT InputType(TunerInputType ti) {
  219.         _ASSERT(*this);
  220.         return (*this)->put_InputType(&ti);
  221.     }
  222.     long CountryCode() {
  223.         _ASSERT(*this);
  224.         long cc;
  225.         HRESULT hr = (*this)->get_CountryCode(&cc);
  226.         if (FAILED(hr)) {
  227.             cc = DEFAULT_ANALOG_TUNER_INPUT_TYPE;
  228.         }
  229.         return cc;
  230.     }
  231.     HRESULT CountryCode(long cc) {
  232.         _ASSERT(*this);
  233.         return (*this)->put_CountryCode(cc);
  234.     }
  235.     long MinChannel() {
  236.         _ASSERT(*this);
  237.         long chan;
  238.         HRESULT hr = (*this)->get_MinChannel(&chan);
  239.         if (FAILED(hr)) {
  240.             chan = DEFAULT_MIN_CHANNEL;
  241.         }
  242.         return chan;
  243.     }
  244.     HRESULT MinChannel(long chan) {
  245.         _ASSERT(*this);
  246.         return (*this)->put_MinChannel(chan);
  247.     }
  248.     long MaxChannel() {
  249.         _ASSERT(*this);
  250.         long chan;
  251.         HRESULT hr = (*this)->get_MaxChannel(&chan);
  252.         if (FAILED(hr)) {
  253.             chan = DEFAULT_MAX_CHANNEL;
  254.         }
  255.         return chan;
  256.     }
  257.     HRESULT MaxChannel(long chan) {
  258.         _ASSERT(*this);
  259.         return (*this)->put_MaxChannel(chan);
  260.     }
  261. };
  262. typedef TNAnalogTVTuningSpaceHelper<PQAnalogTVTuningSpace, PQChannelTuneRequest> TNAnalogTVTuningSpace;
  263.  
  264. template<class TUNINGSPACETYPE, class TUNEREQUESTTYPE> class TNAuxInTuningSpaceHelper : public TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE> {
  265. public:
  266.     TNAuxInTuningSpaceHelper() {}
  267.     TNAuxInTuningSpaceHelper(const TUNINGSPACETYPE &a) : TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>(a) {}
  268.     TNAuxInTuningSpaceHelper(IUnknown *p) : TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>(p) {}
  269.     TNAuxInTuningSpaceHelper(const TNAuxInTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE> &a) : TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>(a) {}
  270.     TNAuxInTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(TNAuxInTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& rhs) {
  271.         TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>::operator=(rhs);
  272.         return *this;
  273.     }
  274.     template<class TS, class TR> TNAuxInTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(TNTuningSpaceHelper<TS, TR>& rhs) {
  275.         TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>::operator=(TUNINGSPACETYPE(rhs));
  276.         return *this;
  277.     }
  278.     TNAuxInTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(TUNINGSPACETYPE& rhs) {
  279.         TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>::operator=(rhs);
  280.         return *this;
  281.     }
  282.     TNAuxInTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(IUnknown* rhs) {
  283.         TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>::operator=(rhs);
  284.         return *this;
  285.     }
  286. };
  287. typedef TNAuxInTuningSpaceHelper<PQAuxInTuningSpace, PQChannelTuneRequest> TNAuxInTuningSpace;
  288.  
  289. template<class TUNINGSPACETYPE, class TUNEREQUESTTYPE> class TNATSCTuningSpaceHelper : public TNAnalogTVTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE> {
  290. public:
  291.     TNATSCTuningSpaceHelper() {}
  292.     TNATSCTuningSpaceHelper(const TUNINGSPACETYPE &a) : TNAnalogTVTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>(a) {}
  293.     TNATSCTuningSpaceHelper(IUnknown *p) : TNAnalogTVTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>(p) {}
  294.     TNATSCTuningSpaceHelper(const TNATSCTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE> &a) : TNAnalogTVTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>(a) {}
  295.  
  296.     TNATSCTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(TNATSCTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& rhs) {
  297.         TNAnalogTVTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>::operator=(rhs);
  298.         return *this;
  299.     }
  300.     template<class TS, class TR> TNATSCTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(TNTuningSpaceHelper<TS, TR>& rhs) {
  301.         TNAnalogTVTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>::operator=(TUNINGSPACETYPE(rhs));
  302.         return *this;
  303.     }
  304.     TNATSCTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(TUNINGSPACETYPE& rhs) {
  305.         TNAnalogTVTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>::operator=(rhs);
  306.         return *this;
  307.     }
  308.     TNATSCTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(IUnknown* rhs) {
  309.         TNAnalogTVTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>::operator=(rhs);
  310.         return *this;
  311.     }
  312.     long MinMinorChannel() {
  313.         _ASSERT(*this);
  314.         long chan;
  315.         HRESULT hr = (*this)->get_MinMinorChannel(&chan);
  316.         if (FAILED(hr)) {
  317.             chan = DEFAULT_MIN_CHANNEL;
  318.         }
  319.         return chan;
  320.     }
  321.     HRESULT MinMinorChannel(long chan) {
  322.         _ASSERT(*this);
  323.         return (*this)->put_MinMinorChannel(chan);
  324.     }
  325.  
  326.     long MaxMinorChannel() {
  327.         _ASSERT(*this);
  328.         long chan;
  329.         HRESULT hr = (*this)->get_MaxMinorChannel(&chan);
  330.         if (FAILED(hr)) {
  331.             chan = DEFAULT_MAX_CHANNEL;
  332.         }
  333.         return chan;
  334.     }
  335.     HRESULT MaxMinorChannel(long chan) {
  336.         _ASSERT(*this);
  337.         return (*this)->put_MaxMinorChannel(chan);
  338.     }
  339.     long MinPhysicalChannel() {
  340.         _ASSERT(*this);
  341.         long chan;
  342.         HRESULT hr = (*this)->get_MinPhysicalChannel(&chan);
  343.         if (FAILED(hr)) {
  344.             chan = DEFAULT_MIN_CHANNEL;
  345.         }
  346.         return chan;
  347.     }
  348.     HRESULT MinPhysicalChannel(long chan) {
  349.         _ASSERT(*this);
  350.         return (*this)->put_MinPhysicalChannel(chan);
  351.     }
  352.  
  353.     long MaxPhysicalChannel() {
  354.         _ASSERT(*this);
  355.         long chan;
  356.         HRESULT hr = (*this)->get_MaxPhysicalChannel(&chan);
  357.         if (FAILED(hr)) {
  358.             chan = DEFAULT_MAX_CHANNEL;
  359.         }
  360.         return chan;
  361.     }
  362.  
  363.     HRESULT MaxPhysicalChannel(long chan) {
  364.         _ASSERT(*this);
  365.         return (*this)->put_MaxPhysicalChannel(chan);
  366.     }
  367. };
  368. typedef TNATSCTuningSpaceHelper<PQATSCTuningSpace, PQATSCChannelTuneRequest> TNATSCTuningSpace;
  369.  
  370. // dvb tuning space
  371. template<class TUNINGSPACETYPE, class TUNEREQUESTTYPE> class TNDVBTuningSpaceHelper : public TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE> {
  372. public:
  373.      TNDVBTuningSpaceHelper() {}
  374.      TNDVBTuningSpaceHelper(const TUNINGSPACETYPE &a) : TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>(a) {}
  375.      TNDVBTuningSpaceHelper(IUnknown *p) : TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>(p) {}
  376.      TNDVBTuningSpaceHelper(const TNDVBTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE> &a) : TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>(a) {}
  377.      TNDVBTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(TNDVBTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& rhs) {
  378.         TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>::operator=(rhs);
  379.         return *this;
  380.      }
  381.      template<class TS, class TR> TNDVBTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(TNTuningSpaceHelper<TS, TR>& rhs) {
  382.         TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>::operator=(TUNINGSPACETYPE(rhs));
  383.         return *this;
  384.      }
  385.      TNDVBTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(TUNINGSPACETYPE& rhs) {
  386.         TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>::operator=(rhs);
  387.         return *this;
  388.     }
  389.      TNDVBTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>& operator=(IUnknown* rhs) {
  390.         TNTuningSpaceHelper<TUNINGSPACETYPE, TUNEREQUESTTYPE>::operator=(rhs);
  391.         return *this;
  392.     }
  393.     DVBSystemType SystemType() const {
  394.         DVBSystemType st;
  395.         HRESULT hr = (*this)->get_SystemType(&st);
  396.         if (FAILED(hr)) {
  397.             return DVB_Cable;
  398.         }
  399.         return st;
  400.     }
  401.     HRESULT SystemType(DVBSystemType st) {
  402.         _ASSERT(*this);
  403.         return (*this)->put_SystemType(st);
  404.     }
  405. };
  406. typedef TNDVBTuningSpaceHelper<PQDVBTuningSpace, PQDVBTuneRequest> TNDVBTuningSpace;
  407.  
  408. // locators
  409. template<class LOCATORTYPE> class TNLocatorHelper : public LOCATORTYPE {
  410. public:
  411.      TNLocatorHelper() {}
  412.      TNLocatorHelper(const LOCATORTYPE &a) : LOCATORTYPE(a) {}
  413.      TNLocatorHelper(IUnknown *p) : LOCATORTYPE(p) {}
  414.      TNLocatorHelper(const TNLocatorHelper<LOCATORTYPE> &a) : LOCATORTYPE(a) {}
  415.      TNLocatorHelper(ILocator *p) : LOCATORTYPE(p) {}
  416.      TNLocatorHelper<LOCATORTYPE>& operator=(TNLocatorHelper<LOCATORTYPE>& rhs) {
  417.         LOCATORTYPE::operator=(rhs);
  418.         return *this;
  419.     }
  420.      TNLocatorHelper<LOCATORTYPE>& operator=(LOCATORTYPE& rhs) {
  421.         LOCATORTYPE::operator=(rhs);
  422.         return *this;
  423.     }
  424.      TNLocatorHelper<LOCATORTYPE>& operator=(ILocator* rhs) {
  425.         LOCATORTYPE::operator=(rhs);
  426.         return *this;
  427.     }
  428.      TNLocatorHelper<LOCATORTYPE>& operator=(IUnknown* rhs) {
  429.         LOCATORTYPE::operator=(rhs);
  430.         return *this;
  431.     }
  432.  
  433.     void Clone() {
  434.         PQLocator t;
  435.         HRESULT hr = (*this)->Clone(&t);
  436.         if (FAILED(hr) || !t) {
  437.             Release();  // clone failed, clear ourselves
  438.             return;
  439.         }
  440.         LOCATORTYPE::operator=(t);
  441.     }
  442.  
  443.     long CarrierFrequency() {
  444.         _ASSERT(*this);
  445.         long f;
  446.         HRESULT hr = (*this)->get_CarrierFrequency(&f);
  447.         if (FAILED(hr)) {
  448.             return -1;
  449.         }
  450.         return f;
  451.     }
  452.     HRESULT CarrierFrequency(long f) {
  453.         _ASSERT(*this);
  454.         return (*this)->put_CarrierFrequency(f);
  455.     }
  456.  
  457.     FECMethod InnerFEC() {
  458.         _ASSERT(*this);
  459.         FECMethod f;
  460.         HRESULT hr = (*this)->get_InnerFEC(&f);
  461.         if (FAILED(hr)) {
  462.             return BDA_FEC_METHOD_NOT_SET;
  463.         }
  464.         return f;
  465.     }
  466.     HRESULT InnerFEC(FECMethod f) {
  467.         _ASSERT(*this);
  468.         return (*this)->put_InnerFEC(f);
  469.     }
  470.     BinaryConvolutionCodeRate InnerFECRate() {
  471.         _ASSERT(*this);
  472.         BinaryConvolutionCodeRate f;
  473.         HRESULT hr = (*this)->get_InnerFECRate(&f);
  474.         if (FAILED(hr)) {
  475.             return BDA_BCC_RATE_NOT_SET;
  476.         }
  477.         return f;
  478.     }
  479.     HRESULT InnerFECRate(BinaryConvolutionCodeRate f) {
  480.         _ASSERT(*this);
  481.         return (*this)->put_InnerFECRate(f);
  482.     }
  483.     FECMethod OuterFEC() {
  484.         _ASSERT(*this);
  485.         FECMethod f;
  486.         HRESULT hr = (*this)->get_OuterFEC(&f);
  487.         if (FAILED(hr)) {
  488.             return BDA_FEC_METHOD_NOT_SET;
  489.         }
  490.         return f;
  491.     }
  492.     HRESULT OuterFEC(FECMethod f) {
  493.         _ASSERT(*this);
  494.         return (*this)->put_OuterFEC(f);
  495.     }
  496.     BinaryConvolutionCodeRate OuterFECRate() {
  497.         _ASSERT(*this);
  498.         BinaryConvolutionCodeRate f;
  499.         HRESULT hr = (*this)->get_OuterFECRate(&f);
  500.         if (FAILED(hr)) {
  501.             return BDA_BCC_RATE_NOT_SET;
  502.         }
  503.         return f;
  504.     }
  505.     HRESULT OuterFECRate(BinaryConvolutionCodeRate f) {
  506.         _ASSERT(*this);
  507.         return (*this)->put_OuterFECRate(f);
  508.     }
  509.     ModulationType Modulation() {
  510.         _ASSERT(*this);
  511.         ModulationType f;
  512.         HRESULT hr = (*this)->get_Modulation(&f);
  513.         if (FAILED(hr)) {
  514.             return BDA_MOD_NOT_SET;
  515.         }
  516.         return f;
  517.     }
  518.     HRESULT Modulation(ModulationType f) {
  519.         _ASSERT(*this);
  520.         return (*this)->put_Modulation(f);
  521.     }
  522.  
  523.     long SymbolRate() {
  524.         _ASSERT(*this);
  525.         long f;
  526.         HRESULT hr = (*this)->get_SymbolRate(&f);
  527.         if (FAILED(hr)) {
  528.             return -1;
  529.         }
  530.         return f;
  531.     }
  532.     HRESULT SymbolRate(long f) {
  533.         _ASSERT(*this);
  534.         return (*this)->put_SymbolRate(f);
  535.     }
  536.  
  537. };
  538. typedef TNLocatorHelper<PQLocator> TNLocator;
  539.  
  540. template<class LOCATORTYPE> class TNATSCLocatorHelper : public TNLocatorHelper<LOCATORTYPE> {
  541. public:
  542.     TNATSCLocatorHelper() {}
  543.     TNATSCLocatorHelper(const LOCATORTYPE &a) : TNLocatorHelper<LOCATORTYPE>(a) {}
  544.     TNATSCLocatorHelper(IUnknown *p) : TNLocatorHelper<LOCATORTYPE>(p) {}
  545.     TNATSCLocatorHelper(const TNATSCLocatorHelper<LOCATORTYPE> &a) : TNLocatorHelper<LOCATORTYPE>(a) {}
  546.     TNATSCLocatorHelper(IATSCLocator *p) : TNLocatorHelper<LOCATORTYPE>(p) {}
  547.     TNATSCLocatorHelper(const TNLocatorHelper<LOCATORTYPE> &a) : TNLocatorHelper<LOCATORTYPE>(a) {}
  548.     TNATSCLocatorHelper<LOCATORTYPE>& operator=(TNATSCLocatorHelper<LOCATORTYPE>& rhs) {
  549.         TNLocatorHelper<LOCATORTYPE>::operator=(rhs);
  550.         return *this;
  551.     }
  552.     TNATSCLocatorHelper<LOCATORTYPE>& operator=(TNLocatorHelper<LOCATORTYPE>& rhs) {
  553.         TNLocatorHelper<LOCATORTYPE>::operator=(rhs);
  554.         return *this;
  555.     }
  556.     TNATSCLocatorHelper<LOCATORTYPE>& operator=(LOCATORTYPE& rhs) {
  557.         TNLocatorHelper<LOCATORTYPE>::operator=(rhs);
  558.         return *this;
  559.     }
  560.     TNATSCLocatorHelper<LOCATORTYPE>& operator=(IATSCLocator* rhs) {
  561.         TNLocatorHelper<LOCATORTYPE>::operator=(rhs);
  562.         return *this;
  563.     }
  564.     TNATSCLocatorHelper<LOCATORTYPE>& operator=(IUnknown* rhs) {
  565.         TNLocatorHelper<LOCATORTYPE>::operator=(rhs);
  566.         return *this;
  567.     }
  568.  
  569.     long PhysicalChannel() {
  570.         _ASSERT(*this);
  571.         long pc;
  572.         HRESULT hr = (*this)->get_PhysicalChannel(&pc);
  573.         if (FAILED(hr)) {
  574.             return -1;
  575.         }
  576.         return pc;
  577.     }
  578.     HRESULT PhysicalChannel(long pc) {
  579.         _ASSERT(*this);
  580.         return (*this)->put_PhysicalChannel(pc);
  581.     }
  582.  
  583.     long TSID() {
  584.         _ASSERT(*this);
  585.         long pc;
  586.         HRESULT hr = (*this)->get_TSID(&pc);
  587.         if (FAILED(hr)) {
  588.             return -1;
  589.         }
  590.         return pc;
  591.     }
  592.     HRESULT TSID(long pc) {
  593.         _ASSERT(*this);
  594.         return (*this)->put_TSID(pc);
  595.     }
  596.  
  597.     long ProgramNumber() {
  598.         _ASSERT(*this);
  599.         long pc;
  600.         HRESULT hr = (*this)->get_ProgramNumber(&pc);
  601.         if (FAILED(hr)) {
  602.             return -1;
  603.         }
  604.         return pc;
  605.     }
  606.     HRESULT ProgramNumber(long pc) {
  607.         _ASSERT(*this);
  608.         return (*this)->put_ProgramNumber(pc);
  609.     }
  610. };
  611. typedef TNATSCLocatorHelper<PQATSCLocator> TNATSCLocator;
  612.  
  613. template<class LOCATORTYPE> class TNDVBSLocatorHelper : public TNLocatorHelper<LOCATORTYPE> {
  614. public:
  615.     TNDVBSLocatorHelper() {}
  616.     TNDVBSLocatorHelper(const LOCATORTYPE &a) : TNLocatorHelper<LOCATORTYPE>(a) {}
  617.     TNDVBSLocatorHelper(IUnknown *p) : TNLocatorHelper<LOCATORTYPE>(p) {}
  618.     TNDVBSLocatorHelper(const TNDVBSLocatorHelper<LOCATORTYPE> &a) : TNLocatorHelper<LOCATORTYPE>(a) {}
  619.     TNDVBSLocatorHelper(IDVBSLocator *p) : TNLocatorHelper<LOCATORTYPE>(p) {}
  620.     TNDVBSLocatorHelper(const TNLocatorHelper<LOCATORTYPE> &a) : TNLocatorHelper<LOCATORTYPE>(a) {}
  621.     TNDVBSLocatorHelper<LOCATORTYPE>& operator=(TNDVBSLocatorHelper<LOCATORTYPE>& rhs) {
  622.         TNLocatorHelper<LOCATORTYPE>::operator=(rhs);
  623.         return *this;
  624.     }
  625.     TNDVBSLocatorHelper<LOCATORTYPE>& operator=(TNLocatorHelper<LOCATORTYPE>& rhs) {
  626.         TNLocatorHelper<LOCATORTYPE>::operator=(rhs);
  627.         return *this;
  628.     }
  629.     TNDVBSLocatorHelper<LOCATORTYPE>& operator=(LOCATORTYPE& rhs) {
  630.         TNLocatorHelper<LOCATORTYPE>::operator=(rhs);
  631.         return *this;
  632.     }
  633.     TNDVBSLocatorHelper<LOCATORTYPE>& operator=(IDVBSLocator* rhs) {
  634.         TNLocatorHelper<LOCATORTYPE>::operator=(rhs);
  635.         return *this;
  636.     }
  637.     TNDVBSLocatorHelper<LOCATORTYPE>& operator=(IUnknown* rhs) {
  638.         TNLocatorHelper<LOCATORTYPE>::operator=(rhs);
  639.         return *this;
  640.     }
  641.  
  642.     Polarisation SignalPolarisation() {
  643.         _ASSERT(*this);
  644.         Polarisation pc;
  645.         HRESULT hr = (*this)->get_SignalPolarisation(&pc);
  646.         if (FAILED(hr)) {
  647.             return -1;
  648.         }
  649.         return pc;
  650.     }
  651.     HRESULT SignalPolarisation(Polarisation pc) {
  652.         _ASSERT(*this);
  653.         return (*this)->put_SignalPolarisation(pc);
  654.     }
  655.  
  656.     VARIANT_BOOL WestPosition() {
  657.         _ASSERT(*this);
  658.         VARIANT_BOOL pc;
  659.         HRESULT hr = (*this)->get_WestPosition(&pc);
  660.         if (FAILED(hr)) {
  661.             return -1;
  662.         }
  663.         return pc;
  664.     }
  665.     HRESULT WestPosition(VARIANT_BOOL pc) {
  666.         _ASSERT(*this);
  667.         return (*this)->put_WestPosition(pc);
  668.     }
  669.  
  670.     long OrbitalPosition() {
  671.         _ASSERT(*this);
  672.         long pc;
  673.         HRESULT hr = (*this)->get_OrbitalPosition(&pc);
  674.         if (FAILED(hr)) {
  675.             return -1;
  676.         }
  677.         return pc;
  678.     }
  679.     HRESULT OrbitalPosition(long pc) {
  680.         _ASSERT(*this);
  681.         return (*this)->put_OrbitalPosition(pc);
  682.     }
  683.  
  684.     long Azimuth() {
  685.         _ASSERT(*this);
  686.         long pc;
  687.         HRESULT hr = (*this)->get_Azimuth(&pc);
  688.         if (FAILED(hr)) {
  689.             return -1;
  690.         }
  691.         return pc;
  692.     }
  693.     HRESULT Azimuth(long pc) {
  694.         _ASSERT(*this);
  695.         return (*this)->put_Azimuth(pc);
  696.     }
  697.  
  698.     long Elevation() {
  699.         _ASSERT(*this);
  700.         long pc;
  701.         HRESULT hr = (*this)->get_Elevation(&pc);
  702.         if (FAILED(hr)) {
  703.             return -1;
  704.         }
  705.         return pc;
  706.     }
  707.     HRESULT Elevation(long pc) {
  708.         _ASSERT(*this);
  709.         return (*this)->put_Elevation(pc);
  710.     }
  711.  
  712. };
  713. typedef TNDVBSLocatorHelper<PQDVBSLocator> TNDVBSLocator;
  714.  
  715.  
  716.  
  717. template<class LOCATORTYPE> class TNDVBTLocatorHelper : public TNLocatorHelper<LOCATORTYPE> {
  718. public:
  719.     TNDVBTLocatorHelper() {}
  720.     TNDVBTLocatorHelper(const LOCATORTYPE &a) : TNLocatorHelper<LOCATORTYPE>(a) {}
  721.     TNDVBTLocatorHelper(IUnknown *p) : TNLocatorHelper<LOCATORTYPE>(p) {}
  722.     TNDVBTLocatorHelper(const TNDVBTLocatorHelper<LOCATORTYPE> &a) : TNLocatorHelper<LOCATORTYPE>(a) {}
  723.     TNDVBTLocatorHelper(IDVBTLocator *p) : TNLocatorHelper<LOCATORTYPE>(p) {}
  724.     TNDVBTLocatorHelper(const TNLocatorHelper<LOCATORTYPE> &a) : TNLocatorHelper<LOCATORTYPE>(a) {}
  725.     TNDVBTLocatorHelper<LOCATORTYPE>& operator=(TNDVBTLocatorHelper<LOCATORTYPE>& rhs) {
  726.         TNLocatorHelper<LOCATORTYPE>::operator=(rhs);
  727.         return *this;
  728.     }
  729.     TNDVBTLocatorHelper<LOCATORTYPE>& operator=(TNLocatorHelper<LOCATORTYPE>& rhs) {
  730.         TNLocatorHelper<LOCATORTYPE>::operator=(rhs);
  731.         return *this;
  732.     }
  733.     TNDVBTLocatorHelper<LOCATORTYPE>& operator=(LOCATORTYPE& rhs) {
  734.         TNLocatorHelper<LOCATORTYPE>::operator=(rhs);
  735.         return *this;
  736.     }
  737.     TNDVBTLocatorHelper<LOCATORTYPE>& operator=(IDVBTLocator* rhs) {
  738.         TNLocatorHelper<LOCATORTYPE>::operator=(rhs);
  739.         return *this;
  740.     }
  741.     TNDVBTLocatorHelper<LOCATORTYPE>& operator=(IUnknown* rhs) {
  742.         TNLocatorHelper<LOCATORTYPE>::operator=(rhs);
  743.         return *this;
  744.     }
  745.  
  746.     long BandWidth() {
  747.         _ASSERT(*this);
  748.         long pc;
  749.         HRESULT hr = (*this)->get_BandWidth(&pc);
  750.         if (FAILED(hr)) {
  751.             return -1;
  752.         }
  753.         return pc;
  754.     }
  755.     HRESULT BandWidth(long pc) {
  756.         _ASSERT(*this);
  757.         return (*this)->put_BandWidth(pc);
  758.     }
  759.  
  760.     FECMethod LPInnerFec() {
  761.         _ASSERT(*this);
  762.         FECMethod pc;
  763.         HRESULT hr = (*this)->get_LPInnerFec(&pc);
  764.         if (FAILED(hr)) {
  765.             return -1;
  766.         }
  767.         return pc;
  768.     }
  769.     HRESULT LPInnerFec(FECMethod pc) {
  770.         _ASSERT(*this);
  771.         return (*this)->put_LPInnerFec(pc);
  772.     }
  773.  
  774.     BinaryConvolutionCodeRate LPInnerFecRate() {
  775.         _ASSERT(*this);
  776.         BinaryConvolutionCodeRate pc;
  777.         HRESULT hr = (*this)->get_LPInnerFecRate(&pc);
  778.         if (FAILED(hr)) {
  779.             return -1;
  780.         }
  781.         return pc;
  782.     }
  783.     HRESULT LPInnerFecRate(BinaryConvolutionCodeRate pc) {
  784.         _ASSERT(*this);
  785.         return (*this)->put_LPInnerFecRate(pc);
  786.     }
  787.  
  788.     HierarchyAlpha HAlpha() {
  789.         _ASSERT(*this);
  790.         HierarchyAlpha pc;
  791.         HRESULT hr = (*this)->get_HAlpha(&pc);
  792.         if (FAILED(hr)) {
  793.             return -1;
  794.         }
  795.         return pc;
  796.     }
  797.     HRESULT HAlpha(HierarchyAlpha pc) {
  798.         _ASSERT(*this);
  799.         return (*this)->put_HAlpha(pc);
  800.     }
  801.  
  802.     GuardInterval Guard() {
  803.         _ASSERT(*this);
  804.         GuardInterval pc;
  805.         HRESULT hr = (*this)->get_Guard(&pc);
  806.         if (FAILED(hr)) {
  807.             return -1;
  808.         }
  809.         return pc;
  810.     }
  811.     HRESULT Guard(GuardInterval pc) {
  812.         _ASSERT(*this);
  813.         return (*this)->put_Guard(pc);
  814.     }
  815.  
  816.     TransmissionMode Mode() {
  817.         _ASSERT(*this);
  818.         TransmissionMode pc;
  819.         HRESULT hr = (*this)->get_Mode(&pc);
  820.         if (FAILED(hr)) {
  821.             return -1;
  822.         }
  823.         return pc;
  824.     }
  825.     HRESULT Mode(TransmissionMode pc) {
  826.         _ASSERT(*this);
  827.         return (*this)->put_Mode(pc);
  828.     }
  829.  
  830.     VARIANT_BOOL OtherFrequencyInUse() {
  831.         _ASSERT(*this);
  832.         VARIANT_BOOL pc;
  833.         HRESULT hr = (*this)->get_OtherFrequencyInUse(&pc);
  834.         if (FAILED(hr)) {
  835.             return -1;
  836.         }
  837.         return pc;
  838.     }
  839.     HRESULT OtherFrequencyInUse(VARIANT_BOOL pc) {
  840.         _ASSERT(*this);
  841.         return (*this)->put_OtherFrequencyInUse(pc);
  842.     }
  843. };
  844. typedef TNDVBTLocatorHelper<PQDVBTLocator> TNDVBTLocator;
  845.  
  846. template<class LOCATORTYPE> class TNDVBCLocatorHelper : public TNLocatorHelper<LOCATORTYPE> {
  847. public:
  848.     TNDVBCLocatorHelper() {}
  849.     TNDVBCLocatorHelper(const LOCATORTYPE &a) : TNLocatorHelper<LOCATORTYPE>(a) {}
  850.     TNDVBCLocatorHelper(IUnknown *p) : TNLocatorHelper<LOCATORTYPE>(p) {}
  851.     TNDVBCLocatorHelper(const TNDVBCLocatorHelper<LOCATORTYPE> &a) : TNLocatorHelper<LOCATORTYPE>(a) {}
  852.     TNDVBCLocatorHelper(IDVBCLocator *p) : TNLocatorHelper<LOCATORTYPE>(p) {}
  853.     TNDVBCLocatorHelper(const TNLocatorHelper<LOCATORTYPE> &a) : TNLocatorHelper<LOCATORTYPE>(a) {}
  854.     TNDVBCLocatorHelper<LOCATORTYPE>& operator=(TNDVBCLocatorHelper<LOCATORTYPE>& rhs) {
  855.         TNLocatorHelper<LOCATORTYPE>::operator=(rhs);
  856.         return *this;
  857.     }
  858.     TNDVBCLocatorHelper<LOCATORTYPE>& operator=(TNLocatorHelper<LOCATORTYPE>& rhs) {
  859.         TNLocatorHelper<LOCATORTYPE>::operator=(rhs);
  860.         return *this;
  861.     }
  862.     TNDVBCLocatorHelper<LOCATORTYPE>& operator=(LOCATORTYPE& rhs) {
  863.         TNLocatorHelper<LOCATORTYPE>::operator=(rhs);
  864.         return *this;
  865.     }
  866.     TNDVBCLocatorHelper<LOCATORTYPE>& operator=(IDVBCLocator* rhs) {
  867.         TNLocatorHelper<LOCATORTYPE>::operator=(rhs);
  868.         return *this;
  869.     }
  870.     TNDVBCLocatorHelper<LOCATORTYPE>& operator=(IUnknown* rhs) {
  871.         TNLocatorHelper<LOCATORTYPE>::operator=(rhs);
  872.         return *this;
  873.     }
  874.  
  875. };
  876. typedef TNDVBCLocatorHelper<PQDVBCLocator> TNDVBCLocator;
  877.  
  878. // tune requests
  879. template<class TUNEREQUESTTYPE, class LOCATORTYPE> class TNTuneRequestHelper : public TUNEREQUESTTYPE {
  880. public:
  881.      TNTuneRequestHelper() {}
  882.      TNTuneRequestHelper(const TUNEREQUESTTYPE &a) : TUNEREQUESTTYPE(a) {}
  883.      TNTuneRequestHelper(IUnknown *p) : TUNEREQUESTTYPE(p) {}
  884.      TNTuneRequestHelper(const TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE> &a) : TUNEREQUESTTYPE(a) {}
  885.      TNTuneRequestHelper(ITuneRequest *p) : TUNEREQUESTTYPE(p) {}
  886.      TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& rhs) {
  887.         TUNEREQUESTTYPE::operator=(rhs);
  888.         return *this;
  889.     }
  890.      TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(TUNEREQUESTTYPE& rhs) {
  891.         TUNEREQUESTTYPE::operator=(rhs);
  892.         return *this;
  893.     }
  894.      TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(ITuneRequest* rhs) {
  895.         TUNEREQUESTTYPE::operator=(rhs);
  896.         return *this;
  897.     }
  898.      TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(IUnknown* rhs) {
  899.         TUNEREQUESTTYPE::operator=(rhs);
  900.         return *this;
  901.     }
  902.     // this function creates a new instance of the base ITuneRequest* and copies
  903.     // all the values of the current ITuneRequest and sets this to the new one
  904.     // this provides the value semantics needed by the network providers
  905.     void Clone() {
  906.         PQTuneRequest t;
  907.         HRESULT hr = (*this)->Clone(&t);
  908.         if (FAILED(hr) || !t) {
  909.             Release();  // clone failed, clear ourselves
  910.             return;
  911.         }
  912.         TUNEREQUESTTYPE::operator=(t);
  913.     }
  914.  
  915.     PQTuningSpace TuningSpace() {
  916.         _ASSERT(*this);
  917.         PQTuningSpace ts;
  918.         HRESULT hr = (*this)->get_TuningSpace(&ts);
  919.         if (FAILED(hr)) {
  920.             return PQTuningSpace();
  921.         }
  922.         return ts;
  923.     }
  924.  
  925.     LOCATORTYPE Locator() {
  926.         _ASSERT(*this);
  927.         PQLocator pc;
  928.         HRESULT hr = (*this)->get_Locator(&pc);
  929.         if (FAILED(hr)) {
  930.             return PQLocator().p;
  931.         }
  932.         return pc.p;
  933.     }
  934.     HRESULT Locator(LOCATORTYPE& pc) {
  935.         _ASSERT(*this);
  936.         return (*this)->put_Locator(pc);
  937.     }
  938. };
  939.  
  940. typedef TNTuneRequestHelper<PQTuneRequest, PQLocator> TNTuneRequest;
  941.  
  942. template<class TUNEREQUESTTYPE, class LOCATORTYPE> class TNChannelTuneRequestHelper : public TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE> {
  943. public:
  944.      TNChannelTuneRequestHelper() {}
  945.      TNChannelTuneRequestHelper(const TNTuneRequest &a) : TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>(a) {}
  946.      TNChannelTuneRequestHelper(IChannelTuneRequest *p) : TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>(p) {}
  947.      TNChannelTuneRequestHelper(IUnknown *p) : TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>(p) {}
  948.      TNChannelTuneRequestHelper(const TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE> &a) : TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>(a) {}
  949.      TNChannelTuneRequestHelper(const TNChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE> &a) : TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>(a) {}
  950.      TNChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(TNChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& rhs) {
  951.         TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>::operator=(rhs);
  952.         return *this;
  953.     }
  954.     template<class TR, class LOC> TNChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(TNTuneRequestHelper<TR, LOC>& rhs) {
  955.         TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>::operator=(TUNEREQUESTTYPE(rhs));
  956.         return *this;
  957.     }
  958.      TNChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(TUNEREQUESTTYPE& rhs) {
  959.         TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>::operator=(rhs);
  960.         return *this;
  961.     }
  962.      TNChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(IChannelTuneRequest* rhs) {
  963.         TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>::operator=(rhs);
  964.         return *this;
  965.     }
  966.      TNChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(IUnknown* rhs) {
  967.         TUNEREQUESTTYPE::operator=(rhs);
  968.         return *this;
  969.     }
  970.     long Channel() {
  971.         _ASSERT(*this);
  972.         long c;
  973.         HRESULT hr = (*this)->get_Channel(&c);
  974.         if (FAILED(hr)) {
  975.             return -1;
  976.         }
  977.         return c;
  978.     }
  979.     HRESULT Channel(long c) {
  980.         _ASSERT(*this);
  981.         return (*this)->put_Channel(c);
  982.     }
  983. };
  984.  
  985. typedef TNChannelTuneRequestHelper<PQChannelTuneRequest, PQLocator> TNChannelTuneRequest;
  986.  
  987. template<class TUNEREQUESTTYPE, class LOCATORTYPE> class TNATSCChannelTuneRequestHelper : public TNChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE> {
  988. public:
  989.     TNATSCChannelTuneRequestHelper() {}
  990.     TNATSCChannelTuneRequestHelper(const TNTuneRequest &a) : TNChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>(a) {}
  991.     TNATSCChannelTuneRequestHelper(IATSCChannelTuneRequest *p) : TNChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>(p) {}
  992.     TNATSCChannelTuneRequestHelper(IUnknown *p) : TNChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>(p) {}
  993.     TNATSCChannelTuneRequestHelper(const TNChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE> &a) : TNChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>(a) {}
  994.     TNATSCChannelTuneRequestHelper(const TNATSCChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE> &a) : TNChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>(a) {}
  995.     TNATSCChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(TNATSCChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& rhs) {
  996.         TNChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>::operator=(rhs);
  997.         return *this;
  998.     }
  999.     template<class TR, class LOC>TNATSCChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(TNTuneRequestHelper<TR, LOC>& rhs) {
  1000.         TNChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>::operator=(TR(rhs));
  1001.         return *this;
  1002.     }
  1003.     TNATSCChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(TUNEREQUESTTYPE& rhs) {
  1004.         TNChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>::operator=(rhs);
  1005.         return *this;
  1006.     }
  1007.     TNATSCChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(IATSCChannelTuneRequest *rhs) {
  1008.         TNChannelTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>::operator=(rhs);
  1009.         return *this;
  1010.     }
  1011.     TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(IUnknown* rhs) {
  1012.         TUNEREQUESTTYPE::operator=(rhs);
  1013.         return *this;
  1014.     }
  1015.     long MinorChannel() {
  1016.         _ASSERT(*this);
  1017.         long mc;
  1018.         HRESULT hr = (*this)->get_MinorChannel(&mc);
  1019.         if (FAILED(hr)) {
  1020.             return -1;
  1021.         }
  1022.         return mc;
  1023.     }
  1024.     HRESULT MinorChannel(long mc) {
  1025.         _ASSERT(*this);
  1026.         return (*this)->put_MinorChannel(mc);
  1027.     }
  1028. };
  1029. typedef TNATSCChannelTuneRequestHelper<PQATSCChannelTuneRequest, PQATSCLocator> TNATSCChannelTuneRequest;
  1030.  
  1031. template<class TUNEREQUESTTYPE, class LOCATORTYPE> class TNDVBTuneRequestHelper : public TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE> {
  1032. public:
  1033.      TNDVBTuneRequestHelper() {}
  1034.      TNDVBTuneRequestHelper(const TNTuneRequest &a) : TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>(a) {}
  1035.      TNDVBTuneRequestHelper(IDVBTuneRequest *p) : TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>(p) {}
  1036.      TNDVBTuneRequestHelper(IUnknown *p) : TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>(p) {}
  1037.      TNDVBTuneRequestHelper(const TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE> &a) : TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>(a) {}
  1038.      TNDVBTuneRequestHelper(const TNDVBTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE> &a) : TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>(a) {}
  1039.      TNDVBTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(TNDVBTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& rhs) {
  1040.         TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>::operator=(rhs);
  1041.         return *this;
  1042.     }
  1043.     template<class TR, class LOC> TNDVBTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(TNTuneRequestHelper<TR, LOC>& rhs) {
  1044.         TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>::operator=(TUNEREQUESTTYPE(rhs));
  1045.         return *this;
  1046.     }
  1047.      TNDVBTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(TUNEREQUESTTYPE& rhs) {
  1048.         TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>::operator=(rhs);
  1049.         return *this;
  1050.     }
  1051.      TNDVBTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(IDVBTuneRequest* rhs) {
  1052.         TNTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>::operator=(rhs);
  1053.         return *this;
  1054.     }
  1055.      TNDVBTuneRequestHelper<TUNEREQUESTTYPE, LOCATORTYPE>& operator=(IUnknown* rhs) {
  1056.         TUNEREQUESTTYPE::operator=(rhs);
  1057.         return *this;
  1058.     }
  1059.     long ONID() {
  1060.         _ASSERT(*this);
  1061.         long c;
  1062.         HRESULT hr = (*this)->get_ONID(&c);
  1063.         if (FAILED(hr)) {
  1064.             return -1;
  1065.         }
  1066.         return c;
  1067.     }
  1068.     HRESULT ONID(long c) {
  1069.         _ASSERT(*this);
  1070.         return (*this)->put_ONID(c);
  1071.     }
  1072.     long TSID() {
  1073.         _ASSERT(*this);
  1074.         long c;
  1075.         HRESULT hr = (*this)->get_TSID(&c);
  1076.         if (FAILED(hr)) {
  1077.             return -1;
  1078.         }
  1079.         return c;
  1080.     }
  1081.     HRESULT TSID(long c) {
  1082.         _ASSERT(*this);
  1083.         return (*this)->put_TSID(c);
  1084.     }
  1085.     long SID() {
  1086.         _ASSERT(*this);
  1087.         long c;
  1088.         HRESULT hr = (*this)->get_SID(&c);
  1089.         if (FAILED(hr)) {
  1090.             return -1;
  1091.         }
  1092.         return c;
  1093.     }
  1094.     HRESULT SID(long c) {
  1095.         _ASSERT(*this);
  1096.         return (*this)->put_SID(c);
  1097.     }
  1098. };
  1099. typedef TNDVBTuneRequestHelper<PQDVBTuneRequest, PQLocator> TNDVBTuneRequest;
  1100. }; // namespace
  1101.  
  1102. #ifndef NO_DEFAULT_BDATUNINGMODEL_NAMESPACE
  1103. using namespace BDATuningModel;
  1104. #endif
  1105.  
  1106. #endif
  1107. // end of file - tune.h
  1108.